package leetcode.tree;

import java.util.ArrayList;
import java.util.List;

public class Lc94 {

    List<Integer> ans ;
    public List<Integer> inorderTraversal(TreeNode root) {
        ans = new ArrayList<>();
        getAns(root);
        return ans;
    }

    private void getAns(TreeNode root) {
        if (root == null) return;
        getAns(root.left);
        ans.add(root.val);
        getAns(root.right);
    }

}

class TreeNode {
  int val;
  TreeNode left;
  TreeNode right;
  TreeNode() {}TreeNode(int val) { this.val = val; }TreeNode(int val, TreeNode left, TreeNode right) {
      this.val = val;
      this.left = left;
      this.right = right;
  }
}

